
enum GameMapConsts {
    LookAt,
    SetMainPlayer,
    LookAtPlayer,
    SetDebugDisplay,
}

class GameMapController extends BaseController {
    private _mapView: GameMapView
    private _mainPlayer: CarObject

    public constructor() {
        super();

        this._mapView = new GameMapView(this, LayerManager.Game_Bg)
        App.ViewManager.register(ViewConsts.GameMap, this._mapView);

        this.registerFunc(GameMapConsts.LookAt, this.LookAt, this);
        this.registerFunc(GameMapConsts.SetMainPlayer, this.SetMainPlayer, this)
        this.registerFunc(GameMapConsts.LookAtPlayer, this.LookAtPlayer, this)
        this.registerFunc(GameMapConsts.SetDebugDisplay, this.SetDebugDisplay, this)
    }

    public LookAt(x: number, y: number): void {
        this._mapView.LookAt(x, y)
    }

    public SetMainPlayer(player: CarObject): void {
        this._mainPlayer = player
        this._mapView.SetMainPlayer(this._mainPlayer)
    }

    public LookAtPlayer(): void {
        this._mapView.LookAtPlayer()
    }

    public SetDebugDisplay(debugDraw: Box2D.Dynamics.b2DebugDraw): void {
        this._mapView.SetDebugDisplay(debugDraw)
    }
}